package tyk.Druid;

import java.sql.SQLException;
import java.util.Scanner;

/***
 *@title TestBaseDao
 *@description <TODO description class purpose>
 *@author Tang'ya'kang
 *@VERSION 1.0.0
 *@CREATE 2023/5/5 16:06
 **/
public class TestBaseDao{
    public static void main(String[] args) throws SQLException {
        //线程本地变量->ThreadLocal
        //增
//        String sql="insert into t_user (account,password,nickname) values (?,?,?);";
//        String account="曾棒",password="123456",nickname="天棒";
//        int rows=BaseDao.executeUpdate(sql,account,password,nickname);
//        if(rows>0) System.out.println("插入成功");
//        else System.out.println("插入失败");

        //删
//        String sql="delete from t_user where id = ?;";
//        String id;
//        Scanner scanner=new Scanner(System.in);
//        id=scanner.nextLine();
//        int rows=BaseDao.executeUpdate(sql,id);
//        if(rows>0) System.out.println("删除成功");
//        else System.out.println("删除失败");

        //改
          String sql="update t_user set password = ? where account = ?;",account,newpassword;
          Scanner scanner=new Scanner(System.in);
          account=scanner.nextLine();
          newpassword=scanner.nextLine();
          int rows=BaseDao.executeUpdate(sql,newpassword,account);
          if(rows>0) System.out.println("修改成功");
          else System.out.println("修改失败");
    }
}
